import njust.csc.aecore.utils.PathUtils
import org.junit.jupiter.api.Test
import kotlin.io.path.*

/**
 * @Author ZhouHang
 * @Date 24/5/29 周三
 */
class PathTest {
    @Test
    fun `Test Path`() {
//        println(PathUtils.OUTPUT.resolveSibling("input"))
//        println(PathUtils.OUTPUT.resolveSibling("a.txt"))
//        for (apk in PathUtils.INPUT.listDirectoryEntries()) {
//            println(apk)
//        }
        val a = Path("1/2.apk")
        println(a.name)
    }

    @Test
    fun `Test List`() {
        val a = listOf("gcc", "-o")
        val b = a + listOf("-c")
        println(b.joinToString(separator = " "))
    }

    @Test fun `Test relative Path`() {
        val p = Path("N:/a/b/c/output/userInput/s.json").relativeTo(Path("N:/a/b/c/output/"))
        println("================ ${p.toString()} ===================")
    }

    @Test fun `Test toUri`() {
        val a = Path("123/456.pdf")
        println("================ ${a} ===================")
    }

    @Test fun `Test Path Find`() {
        val dir = Path("N:\\Code\\PL\\StaticAnalysis\\ApkExplorer\\output\\userInput\\ac6ae201b2b4e918c66c9d61d4a65e3c")
        val fileList = PathUtils.xmlsInSequence(dir)
        fileList.forEach {
            println(it.name)
        }
    }

    @Test fun `Test Extract Number`() {
        val number = PathUtils.extractNumber("step-21--g0a4-1719933587519.png")
        println(number)
    }
}